public class ques4 {
	public static void main(String args[]) {
		int i,j;
		long add = 0;
		for (i=3;i<1000;i++) {
			for (j=1;j<i;j++) {
				if(i%j == 0) {
					add+=j;
				}
			}
			if (add == i) {
				System.out.println(i);
			}
			add = 0;
		}
	}
}
